import { GameContext } from "@sapi-game/gameContext";
import { DirtShopMap, DirtShopMaps } from "./map";
import { PlayerGroup, PlayerGroupSet } from "@sapi-game/gamePlayer";
import { DirtShopPlayer } from "./player";
import { DirtShopConfig } from "./interface";

export class DirtShopContext extends GameContext {
    readonly host: PlayerGroup<DirtShopPlayer>;
    readonly attacker: PlayerGroup<DirtShopPlayer>;
    readonly groupSet: PlayerGroupSet<DirtShopPlayer>;
    readonly map: DirtShopMap;
    readonly config: DirtShopConfig;

    bedExists: boolean = true;

    constructor(
        host: PlayerGroup<DirtShopPlayer>,
        attacker: PlayerGroup<DirtShopPlayer>,
        config: DirtShopConfig
    ) {
        super();
        this.host = host;
        this.attacker = attacker;
        this.groupSet = new PlayerGroupSet([host, attacker]);
        this.map = DirtShopMaps[config.mapIndex] ?? DirtShopMaps[0];
        this.config = config;
    }
}
